<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(item,index) in list " :class="{active: current===index}" @click="current=index">{{item}}</li>
        </ul>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const app = new Vue({
            el:"#app",
            data:{
                current:0,
                list:[
                    "生活用品",
                    "零食",
                    "啤酒饮料"
                ]
            }
        })

    </script>
    <style>
        ul {
            width: 200px;
            display: flex;
            justify-content: space-between;
            list-style: none;
        }

        ul li {
            /* display: block; */
            height: 50px;
            width: 80px;
            /* margin: 0 auto; */
            text-align: ;
            /* background-color: pink; */
            line-height: 50px;
        }

        .active{
            background-color: skyblue;
        }


    </style>
</body>

</html>